const path = require('path')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const webpack = require('webpack')
const AddAssetHtmlWebpackPlugin = require('add-asset-html-webpack-plugin')
module.exports = {
    entry: './js/index.js',
    output: {
        filename: 'index.js',
        path: path.resolve(__dirname, 'dist')
    },
    module: {
        rules: [

        ]
    },
    plugins: [
        new HtmlWebpackPlugin({
            template: "./index.html"
        }),
        //告诉webpack哪些库不参与打包，且同时使用时名称也需要改
        new webpack.DllReferencePlugin({
            manifest: path.resolve(__dirname, 'dll/manifest.json')
        }),
        //将某个文件打包出去，自动合并到html中引入
        new AddAssetHtmlWebpackPlugin({
            filepath: path.resolve(__dirname, 'dll/manifest.json')
        })
    ],
    mode: 'production',

}